#include "sct/rtspserver/tsservermediasubsession.h"
#include "sct/rtspserver/tssource.h"

#include "SimpleRTPSink.hh"
#include "GroupsockHelper.hh"

namespace sct
{
CTsServerMediaSubsession*
CTsServerMediaSubsession::createNew(UsageEnvironment& env, void* source, Boolean reuseFirstSource)
{
	return new CTsServerMediaSubsession(env, source, reuseFirstSource);
}

CTsServerMediaSubsession::CTsServerMediaSubsession(UsageEnvironment& env, void* source,
			Boolean reuseFirstSource):
					OnDemandServerMediaSubsession(env, True),
					mSource(source)
{
	;
}

CTsServerMediaSubsession::~CTsServerMediaSubsession()
{
	;
}

RTPSink* CTsServerMediaSubsession
::createNewRTPSink(Groupsock* rtpGroupsock, unsigned char /*rtpPayloadTypeIfDynamic*/, FramedSource* /*inputSource*/) {
  return SimpleRTPSink::createNew(envir(), rtpGroupsock,
				  33, 90000, "video", "MP2T",
				  1, True, False /*no 'M' bit*/);
}

FramedSource* CTsServerMediaSubsession::createNewStreamSource(unsigned clientSessionId,
						      unsigned& estBitrate)
{
	estBitrate = 96;

	return CTsSource::createNew(envir(), mSource);
}
}//end namespace
